import { injectable } from "inversify";
import { TerminalShellType } from "../types";
import { ActivationScripts, VenvBaseActivationCommandProvider } from "./baseActivationProvider";

const SCRIPTS: ActivationScripts = ({
  // Group 1
  [TerminalShellType.wsl]: ['activate.sh', 'activate'],
  [TerminalShellType.ksh]: ['activate.sh', 'activate'],
  [TerminalShellType.zsh]: ['activate.sh', 'activate'],
  [TerminalShellType.gitbash]: ['activate.sh', 'activate'],
  [TerminalShellType.bash]: ['activate.sh', 'activate'],
  // Group 2
  [TerminalShellType.tcshell]: ['activate.csh'],
  [TerminalShellType.cshell]: ['activate.csh'],
  // Group 3
  [TerminalShellType.fish]: ['activate.fish'],
} as unknown) as ActivationScripts;


@injectable()
export class Bash extends VenvBaseActivationCommandProvider {
    protected readonly scripts = SCRIPTS;

    public async getActivationCommandsForInterpreter(
        pythonPath: string,
        targetShell: TerminalShellType,
    ): Promise<string[] | undefined> {
        const scriptFile = await this.findScriptFile(pythonPath, targetShell);
        if (!scriptFile) {
            return;
        }
        return [`source ${scriptFile.fileToCommandArgumentForEQExt()}`];
    }
}